
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 2
 * @Author : WangRuoyu 
 * @Date : 2023/5/18 20:14
 */

#include "iostream"

using namespace std;

const int S = 60;
const int N = 1010;
int b[S][S];
int trees[N][2];
int n, l, s, cnt = 0;

bool check(int x, int y) {
    if (x + s > l || y + s > l) return false;
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        if (trees[i][0] >= x && trees[i][0] <= x + s && trees[i][1] >= y && trees[i][1] <= y + s) {
            if (b[trees[i][0] - x][trees[i][1] - y])sum++;
            else return false;
        }
    }
    if (sum == cnt) return true;
    else return false;
}

int main() {
    scanf("%d %d %d", &n, &l, &s);

    for (int i = 0; i < n; ++i) {
        scanf("%d %d", &trees[i][0], &trees[i][1]);
    }

    for (int i = s; i >= 0; --i) {
        for (int j = 0; j <= s; ++j) {
            scanf("%d", &b[i][j]);
            if (b[i][j]) cnt++;
        }
    }

    int res = 0;
    for (int i = 0; i < n; ++i) {
        if (check(trees[i][0], trees[i][1])) res++;
    }

    printf("%d", res);

    return 0;
}